library(sf)
## Linking to GEOS 3.7.2, GDAL 2.4.2, PROJ 5.2.0
library(tmap)
library(tmaptools)
library(ggplot2)
library(tidyverse)
## ── Attaching packages ──────────────────────────────────────────────────────── tidyverse 1.3.0 ──
## ✓ tibble  3.0.1     ✓ dplyr   1.0.0
## ✓ tidyr   1.1.0     ✓ stringr 1.4.0
## ✓ readr   1.3.1     ✓ forcats 0.5.0
## ✓ purrr   0.3.4
## ── Conflicts ─────────────────────────────────────────────────────────── tidyverse_conflicts() ──
## x dplyr::filter() masks stats::filter()
## x dplyr::lag()    masks stats::lag()
library(here)
## here() starts at /Users/dereknguyen/Documents/DEVELOP Internship/DEVELOP_SC
library(janitor)
## 
## Attaching package: 'janitor'
## The following objects are masked from 'package:stats':
## 
##     chisq.test, fisher.test
library(ggmap)
## Google's Terms of Service: https://cloud.google.com/maps-platform/terms/.
## Please cite ggmap if you use it! See citation("ggmap") for details.
library(maps)
## 
## Attaching package: 'maps'
## The following object is masked from 'package:purrr':
## 
##     map
library(mapdata)

Read in shapefiles

huc8_1 <- read_sf(dsn = here("HU8_03050112_watershed", "HU8_03050112_Watershed"),
                  layer = "HU8_03050112_Wetlands") %>% 
  clean_names() %>% 
  filter(wetland_ty %in% "Estuarine and Marine Wetland")

huc8_2 <- read_sf(dsn = here("HU8_03050201_watershed", "HU8_03050201_Watershed"),
                  layer = "HU8_03050201_Wetlands") %>% 
  clean_names() %>% 
  filter(wetland_ty %in% "Estuarine and Marine Wetland")

huc8_3 <- read_sf(dsn = here("HU8_03050202_watershed", "HU8_03050202_Watershed"),
                  layer = "HU8_03050202_Wetlands") %>% 
  clean_names() %>% 
  filter(wetland_ty %in% "Estuarine and Marine Wetland")

huc8_4 <- read_sf(dsn = here("HU8_03050206_watershed", "HU8_03050206_Watershed"),
                  layer = "HU8_03050206_Wetlands") %>% 
  clean_names() %>% 
  filter(wetland_ty %in% "Estuarine and Marine Wetland")

huc8_5 <- read_sf(dsn = here("HU8_03050209_watershed", "HU8_03050209_Watershed"),
                  layer = "HU8_03050209_Wetlands") %>% 
  clean_names() %>% 
  filter(wetland_ty %in% "Estuarine and Marine Wetland")
huc8_interactive <- 
  tm_basemap("Esri.WorldImagery") +
  tm_shape(huc8_1) +
  tm_fill("wetland_ty", alpha = 0.7, legend.show = FALSE) +
  tm_shape(huc8_2) +
  tm_fill("wetland_ty", alpha = 0.7, legend.show = FALSE) +
  tm_shape(huc8_3) +
  tm_fill("wetland_ty", alpha = 0.7, legend.show = FALSE) +
  tm_shape(huc8_5) +
  tm_fill("wetland_ty", alpha = 0.7, legend.show = FALSE) +
  tm_shape(huc8_4) +
  tm_fill("wetland_ty", alpha = 0.7, legend.show = FALSE) +
  tm_layout(title = "South Carolina Wetland Study Area")

tmap_mode("view")
## tmap mode set to interactive viewing
huc8_interactive
## Warning: The shape huc8_5 is invalid. See sf::st_is_valid
## Warning: The shape huc8_4 is invalid. See sf::st_is_valid